use crate::accrual::Accrual;

use fixed_macro::fixed;
use crate::accro;

pub struct AccrualSequence<'a>(pub &'a Vec<Accrual>);

impl<'a> AccrualSequence<'a> {

    pub fn plus(&self) -> Accrual {
    
        let mut sum_acrl = accro!(0, 0);
       
        for acrl in self.0.iter() {
            sum_acrl.plus(acrl);
        }
        
        sum_acrl
    }
}

#[macro_export]
macro_rules! accro_seq{
    ($($x:expr),*) => (vec![$($x),*]);
    ($($x:expr,)*) => (accro_seq![$($x),*])
}
